/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Controlador;

import Modelo.ENT_Perfil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Isaac Paliza <anndysaac@hotmail.com>
 */
public class CTRL_Perfil {
    private static final ConnectionJDBC connectionJDBC = new ConnectionJDBC();
    private static final Statement statement = connectionJDBC.createStatement();
    public static String Mensaje;
    
    public static List CargarListPerfil() throws SQLException {
        ArrayList<ENT_Perfil> ListaPerfil = new ArrayList();
        String sql = "SELECT idPerfil, nombre, descripcion "
                + "FROM t_perfil ";
        ResultSet recordingResults2
                = ConnectionJDBC.executeQuery(statement, sql);
        while (recordingResults2.next()) {
            String idPerfilAux = recordingResults2.getString(1);
            if (recordingResults2.wasNull()) {
                idPerfilAux = "";
            }
            String nombreAux = recordingResults2.getString(2);
            if (recordingResults2.wasNull()) {
                nombreAux = "";
            }
            String descripcionAux = recordingResults2.getString(3);
            if (recordingResults2.wasNull()) {
                descripcionAux = "";
            }
            ListaPerfil.add(new ENT_Perfil(idPerfilAux, nombreAux, descripcionAux));
        }
        return ListaPerfil;
    }
}
